# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-fsnotify-fsnotify
pkgver=1.5.4
pkgrel=1
pkgdesc="Cross-platform file system notifications for Go"
arch=('any')
url="https://github.com/fsnotify/fsnotify"
license=('BSD')
depends=('go' 'golang-golang-x-sys')
source=("$pkgname-$pkgver.tar.gz::https://github.com/fsnotify/fsnotify/archive/v$pkgver.tar.gz")
sha512sums=('173c8f04e3d36aace342784359f16b7c5af8f8eb331c26358ae3d533bc1c3b4942384d0e0c39d5f8a201c69b475cca624e64fe5d7d22b6184de10179a096d7c1')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/fsnotify
  cp -a "$srcdir"/fsnotify-$pkgver "$srcdir"/build/src/github.com/fsnotify/fsnotify
  cd "$srcdir"/build/src/github.com/fsnotify/fsnotify
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/fsnotify
  cp -a "$srcdir"/fsnotify-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/fsnotify/fsnotify

  install -Dm644 fsnotify-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
